Hi!
/*===========================================================================================
Variables
==========================================================================================*/
Object obj = current
Object po = parent obj
int iQ2, iQ3, iQ4, iQ4a, iQ4b, iQ5
string currentQ2, currentQ3, currentQ4, currentQ4a, currentQ4b, currentQ5
/*=====*======*======*======*======*=====*=====*======*======*======*======*=====*=====*===
/////////////// Interface Items ////////////////
*=====*======*======*======*======*=====*=====*======*======*======*======*=====*=====*===*/
DB verEvidenceBox = create("Checklist - Rev(-)")
DBE newReportButton, nextButton, prevButton
DBE tagField, statusField, authorField
DBE selectChoiceQ1, selectChoiceQ2, selectChoiceQ3, selectChoiceQ4, selectChoiceQ4a, selectChoiceQ4b, selectChoiceQ5
DBE richTextReq, richTextApp
/*===========================================================================================
Answer Types
==========================================================================================*/
string options[] = {"YES", "NO"}
string errMess = "Error creating type"
AttrType answerType = find(current Module, "Answer")
if (null answerType) answerType = create ("Answer", options, errMess)
/*===========================================================================================
Creates attributes necessary to validate.
==========================================================================================*/
void createValidationAttr(string typeName, string aName){
AttrDef ad = find(current Module, aName)
if(null ad) create object type typeName (default "NO") changeBars false attribute aName
else // print "Attr Def '" aName "' already exists.\n"
}
// Attributes: "Validation Qn"
createValidationAttr("Answer", "Validation Q2")
createValidationAttr("Answer", "Validation Q3")
createValidationAttr("Answer", "Validation Q4")
createValidationAttr("Answer", "Validation Q4a")
createValidationAttr("Answer", "Validation Q4b")
createValidationAttr("Answer", "Validation Q5")
if(!exists attribute "Checker") create type "Text" changeBars false attribute "Checker"
if(!exists attribute "Author") create type "Text" changeBars false attribute "Author"
/*========================================================================================
Functions
==========================================================================================*/
void deleteAttrDef(string s){
AttrDef ad = find(current Module, s)
if (null ad) // print "Attr Def '" s "' does not exist.\n"
else delete(ad)
}
void deleteAttrType(string s){
string err = ""
AttrType at = find(current Module, s)
if (null at) // print "Attr Type '" s "' does not exist.\n"
else delete(at, err)
}
// Status field will always reflect the actual answers for all questions
void setStatus(){
}
// Return the last author of the current object
string lastObjectTextModifier(){
History h
string lastAuthor = ""
for h in current Object do {
HistoryType ht = h.type
if (ht == modifyObject && h.attrName == "Object Text") lastAuthor = h.author
}
return lastAuthor
}
void updateVariables() {
string currentQ2 = obj."Validation Q2" ""
string currentQ3 = obj."Validation Q3" ""
string currentQ4 = obj."Validation Q4" ""
string currentQ4a = obj."Validation Q4a" ""
string currentQ4b = obj."Validation Q4b" ""
string currentQ5 = obj."Validation Q5" ""
for iQ2 in 0:2 by 1 do {
if (currentQ2 == answerType.strings[iQ2]) { break }
iQ2++
}
for iQ3 in 0:2 by 1 do {
if (currentQ3 == answerType.strings[iQ3]) { break }
iQ3++
}
for iQ4 in 0:2 by 1 do {
if (currentQ4 == answerType.strings[iQ4]) { break }
iQ4++
}
for iQ4a in 0:2 by 1 do {
if (currentQ4a == answerType.strings[iQ4a]) { break }
iQ4a++
}
for iQ4b in 0:2 by 1 do {
if (currentQ4b == answerType.strings[iQ4b]) { break }
iQ4b++
}
for iQ5 in 0:2 by 1 do {
if (currentQ5 == answerType.strings[iQ5]) { break }
iQ5++
}
set(tagField, identifier(obj))
set(selectChoiceQ2,iQ2)
set(selectChoiceQ3,iQ3)
set(selectChoiceQ4,iQ4)
set(selectChoiceQ4a,iQ4a)
set(selectChoiceQ4b,iQ4b)
set(selectChoiceQ5,iQ5)
if(null obj."Object Text" "") set(richTextReq, "<Title>")
else set(richTextReq, obj."Object Text" "")
setStatus()
refresh current Module
}
bool notExistAttribute(string aName){
AttrDef ad = find(current Module, aName)
if (null ad) return true
else return false
}
// Save all validation questions and Validation Comments
void saveObjects(){
string aux = ""
int i
bool wasModified = false
if(canModify(obj)){
aux = get(selectChoiceQ2)
if(obj."Validation Q2" "" != aux) {
obj."Validation Q2" = aux
wasModified = true
}
aux = get(selectChoiceQ3)
if(obj."Validation Q3" "" != aux) {
obj."Validation Q3" = aux
wasModified = true
}
aux = get(selectChoiceQ4)
if(obj."Validation Q4" "" != aux) {
obj."Validation Q4" = aux
wasModified = true
}
aux = get(selectChoiceQ4a)
if(obj."Validation Q4a" "" != aux) {
obj."Validation Q4a" = aux
wasModified = true
}
aux = get(selectChoiceQ4b)
if(obj."Validation Q4b" "" != aux) {
obj."Validation Q4b" = aux
wasModified = true
}
aux = get(selectChoiceQ5)
if(obj."Validation Q5" "" != aux) {
obj."Validation Q5" = aux
wasModified = true
}
// Save checker
if(wasModified){ // Saves Checker just if something has changed.
User u = find() // returns current user login.
string uName = u.name
if(obj."Object Heading" "" == "") obj."Checker" = uName// just save if is requirement.
}
}
else infoBox "Cannot modify current object."
}
void saveReport(DB calledFrom){
saveObjects() // Saves all validation questions and Validation Comments.
save(current Module)
refresh (current Module)
}
void closeBox(DB calledFrom){
if(unsaved(current Module)){
string buttons[] = {"Yes", "No"}
int answer = messageBox("To save the validation, save current module. \nSave current module?", buttons, msgWarning)
if(buttons[answer] == "Yes") {
saveObjects() // Saves all validation questions and Validation Comments.
save(current Module)
refresh (current Module)
}
}
hide calledFrom
}
void selectNext(DB calledFrom) {
saveObjects() // Save all validation questions and Validation Comments
// go to next object and Check if module is in exclusive edit or not.
if (!null (next obj)&&(canModify(next obj))) {
obj = next(obj)
current = obj
updateVariables()
}
else{
infoBox "Open module as Shareable or Exclusive Edit."
}
}
void selectPrev(DB calledFrom) {
saveObjects() // Save all validation questions and Validation Comments
// go back to previous object and Check if module is in exclusive edit or not.
if (!null (previous obj)&&(canModify(previous obj))) {
obj = previous(obj)
current = obj
updateVariables()
}
else{
infoBox "Open module as Shareable or Exclusive Edit."
}
}
bool notExistAttribute(string attrName){
AttrDef ad = find(current Module, attrName)
if (null ad) return true
else {
// print "Attribute '" attrName "' alredy exists. Could not create.\n"
return false
}
}
// Some checks to init GUI.
bool canInit(){
// Check if module has requirements.
if(null obj) {
infoBox "Module without requirements to validate."
return false
}
// Check if module is in exclusive edit or not.
if(!canModify(current Object)){
infoBox "Open module as Shareable or Exclusive Edit."
return false
}
return true
}
/*========================================================================================
Main Program
==========================================================================================*/
// Start to buid GUI
if(canInit()){
// Creation of Buttons and function associated to 'close'
prevButton = apply(verEvidenceBox, "<<&Previous Req", selectPrev)
nextButton = apply(verEvidenceBox, "&Next Req>>", selectNext)
saveButton = apply(verEvidenceBox, "&Save Module", saveReport)
close(verEvidenceBox, true, closeBox)
// Shows Tag
tagField = field(verEvidenceBox, "Tag:", identifier(obj), 25, true)
tagField->"left"->"unattached"
tagField-> "top"-> "form"
richTextReq = richText(verEvidenceBox, "", po."Object Heading" "" , 60, true) // Shows the requirement "Object Text"
richTextReq = richText(verEvidenceBox, "", obj."Object Text" "" , 60, true) // Shows the requirement "Object Text"
// Questions
selectChoiceQ2 = choice(verEvidenceBox, "Q2:?", options, 1, 13,false)
selectChoiceQ3 = choice(verEvidenceBox, "Q3:?", options, 1, 13,false)
selectChoiceQ4 = choice(verEvidenceBox, "Q4:?", options, 1, 13,false)
selectChoiceQ4a = choice(verEvidenceBox, "Q4a: ?", options, 1, 13,false)
selectChoiceQ4b = choice(verEvidenceBox, "Q4b:?", options, 1, 13,false)
selectChoiceQ5 = choice(verEvidenceBox, "Q5: ?", options, 1, 13,false)
statusField = field(verEvidenceBox, "Status", "", 13, true)
show verEvidenceBox
}
Bruwbruw - Fri Jul 20 12:09:19 EDT 2012 |
Re: Show parent heading
I think my 2nd and 3rd observations resolve your problems 1 and 2. -Louie |
Re: Show parent heading llandale - Fri Jul 20 12:37:40 EDT 2012
I think my 2nd and 3rd observations resolve your problems 1 and 2. -Louie
I still having the problem... i did correct the follow line:
if(null po."Object Heading" "") set(richTextHeading, obj."Object Heading" "")
else set(richTextHeading, po."Object Heading" "")
if(null obj."Object Text" "") set(richTextReq, "<Title>")
else set(richTextReq, obj."Object Text" "")
void selectNext(DB calledFrom) {
saveObjects() // Save all validation questions and Validation Comments
// go to next object and Check if module is in exclusive edit or not.
if (!null (next obj)&&(canModify(next obj))) {
obj = next(obj)
current = obj
if (!null (next po)&&(canModify(next po))) {
po = next(po)
}
updateVariables()
}
else{
infoBox "Open module as Shareable or Exclusive Edit."
}
}
void selectPrev(DB calledFrom) {
saveObjects() // Save all validation questions and Validation Comments
// go back to previous object and Check if module is in exclusive edit or not.
if (!null (previous obj)&&(canModify(previous obj))) {
obj = previous(obj)
current = obj
if (!null (previous po)&&(canModify(previous po))) {
po = next(po)
}
updateVariables()
}
else{
infoBox "Open module as Shareable or Exclusive Edit."
}
}
|
Re: Show parent heading Bruwbruw - Mon Jul 23 09:18:37 EDT 2012
I still having the problem... i did correct the follow line:
if(null po."Object Heading" "") set(richTextHeading, obj."Object Heading" "")
else set(richTextHeading, po."Object Heading" "")
if(null obj."Object Text" "") set(richTextReq, "<Title>")
else set(richTextReq, obj."Object Text" "")
void selectNext(DB calledFrom) {
saveObjects() // Save all validation questions and Validation Comments
// go to next object and Check if module is in exclusive edit or not.
if (!null (next obj)&&(canModify(next obj))) {
obj = next(obj)
current = obj
if (!null (next po)&&(canModify(next po))) {
po = next(po)
}
updateVariables()
}
else{
infoBox "Open module as Shareable or Exclusive Edit."
}
}
void selectPrev(DB calledFrom) {
saveObjects() // Save all validation questions and Validation Comments
// go back to previous object and Check if module is in exclusive edit or not.
if (!null (previous obj)&&(canModify(previous obj))) {
obj = previous(obj)
current = obj
if (!null (previous po)&&(canModify(previous po))) {
po = next(po)
}
updateVariables()
}
else{
infoBox "Open module as Shareable or Exclusive Edit."
}
}
Well did you correct this too? richTextReq = richText(verEvidenceBox, "", po."Object Heading" "" , 60, true) richTextReq = richText(verEvidenceBox, "", obj."Object Text" "" , 60, true) // assigning to the same DBE!
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|